home *** CD-ROM | disk | FTP | other *** search
/ Directorty Opus 5 - Magellan 2 / Opus 5 - Magellan 2.iso / Extras / D51_NUSource / Source / Routines / OpenLibraries_Error_Req.s < prev    next >
Text File  |  1995-08-11  |  4KB  |  128 lines

  1. ;---------------------------------------------------------------------------;
  2. ; Obviously, the error routine should not rely upon any libs being open!!   ;
  3. ; Temp001(a5) will be used as a base for intuition.library                  ;
  4. ; Temp002(a5) will be used as the adr of the allocated mem for Req text.    ;
  5. ; - This routine will attempt to bring up a requester showing a list of     ;
  6. ;   which libraries couldn't be openned (including the required versions).  ;
  7. ; - An EasyRequest is be used, but v1.3 lamers don't have them, so if we    ;
  8. ;   can't open v37, a DisplayAlert will tell them they need to upgrade.     ;
  9. ;---------------------------------------------------------------------------;
  10. OpnLib_Error_Title
  11.     PROGNAM
  12.     Dc.b    ":",0
  13. OpnLib_Error_Body_Header
  14.     Dc.b    "Could not open the following libraries:",10
  15.     Dc.b    "(Minimum version numbers shown.)",10,10,0
  16. OpnLib_Error_Body_Header_Length Equ (*-OpnLib_Error_Body_Header)-1
  17. OpnLib_Error_Body_Main_Length Equ 40
  18. ; 30 chars = maximum file length, + " vXX",10,0 + a bit more.
  19. OpnLib_Error_Body_Length Equ OpnLib_Error_Body_Header_Length+(NumLibs*OpnLib_Error_Body_Main_Length)
  20. OpnLib_Error_Gads
  21.     Dc.b    "OK",0
  22.     Even
  23. ;---------------------------------------------------------------------------;
  24. OpnLib_Error
  25.     Lea    N_IntName(pc),a1
  26.     Moveq    #37,d0
  27.     N_CallExec    OpenLibrary
  28.     Move.l    d0,Temp001(a5)        Store base adr.
  29.     Beq    OpnLib_Error_Error    If we can't get it, DisplayAlert 'em.
  30.  
  31.     Bsr.s    BuildLibList        Adr into Temp002(a5)
  32.  
  33.     Move.l    #N_EasyStruct_Len,N_ES_Length(a5)    Size of structure.
  34.     Move.l    #0,N_ES_Flags(a5)        No flags.
  35.     Lea    OpnLib_Error_Title(pc),a0    -.
  36.     Move.l    a0,N_ES_Title(a5)         |
  37.     Move.l    Temp002(a5),N_ES_Body(a5)     |- Texts for req.
  38.     Lea    OpnLib_Error_Gads(pc),a0     |
  39.     Move.l    a0,N_ES_Gadgets(a5)        -'
  40.  
  41.     Lea    N_EasyStruct(a5),a1    Point to EasyRequest structure.
  42.     Sub.l    a0,a0            Specify default public screen.
  43.     Move.l    a0,a2            No IDCMP flags.
  44.     Move.l    a0,a3            No arguments.
  45.     Move.l    Temp001(a5),a6
  46.     Jsr    _LVOEasyRequestArgs(a6)    Put up the request.
  47.  
  48.     Move.l    #OpnLib_Error_Body_Length,d0    -.
  49.     Move.l    Temp002(a5),a1             |- Deallocate Msg mem.
  50.     Bsr    LeoFreePooled            -'
  51.  
  52. OpnLib_Error__2
  53.     Move.l    Temp001(a5),a1        -.
  54.     N_CallExec    CloseLibrary     |- Close intuition.library
  55.     Bra    Finish            -'  and Finish program.
  56. ;---------------------------------------------------------------------------;
  57. BuildLibList
  58.     Move.l    #OpnLib_Error_Body_Length,d0    -.  Allocate for
  59.     Bsr    LeoAllocPooled            -'  Error Message.
  60.     Move.l    d0,Temp002(a5)
  61.     Beq.s    OpnLib_Error__2        If Allocation failed, Exit Program
  62.  
  63.     Move.l    Temp002(a5),a1        Memory to write message into...
  64.     Lea    OpnLib_Error_Body_Header(pc),a0
  65.     Bsr    CopyCN3            Copy it (excluding null).
  66.  
  67.     Lea    LibData_Start(pc),a2    Start of struc w/ name-ptrs and ver#s
  68.     Lea    LibBases_Start(a5),a3    Start of struc w/ Base-Adrs.
  69.  
  70. BuildLibList_MainLoop
  71.     Lea    LibBases_Finish(a5),a4
  72.     Cmp.l    a4,a3            All libraries been checked?
  73.     Blt.s    OLEBL_Skp1
  74.     SF    -1(a1)            -._ If so, null terminate
  75.     RTS                -'  and return completed list.
  76. OLEBL_Skp1
  77.     Tst.l    (a3)+            Did this lib fail to open?
  78.     Beq.s    OLEBL_Skp2        If not, don't include in msg.
  79.     Addq.l    #8,a2            Update the other pointer.
  80.     Bra.s    BuildLibList_MainLoop    Check the rest of the libs.
  81.  
  82. OLEBL_Skp2
  83.     Lea    LibNames_Start(pc),a0    -._ Point to the name of
  84.     Add.l    (a2)+,a0        -'  the lib.
  85.     Bsr    CopyCN3            Copy it (excluding null).
  86.     Move.b    #" ",(a1)+        A space after it.
  87.     Move.b    #"v",(a1)+        version...
  88.  
  89.     Move.l    (a2)+,d1        Version of lib.
  90.     Bsr    N2A2Dig            Convert number to output.
  91. ;    Note: N2A2Dig ONLY uses d1 and a1.
  92.     Move.b    #10,(a1)+        A return after it.
  93.  
  94.     Bra.s    BuildLibList_MainLoop
  95. ;---------------------------------------------------------------------------;
  96. OpnLib_Error_Error
  97.     Lea    N_IntName(pc),a1
  98.     Moveq    #0,d0            ANY version, using DisplayAlert()
  99.     N_CallExec    OpenLibrary
  100.     Move.l    d0,Temp001(a5)        Store base adr.
  101.     Beq    Finish            If we can't get it, just exit!
  102.  
  103.     Lea    OpnLib_Error_Msg_Header(pc),a0
  104.     Move.l    #OpnLib_Error_Msg_Height,d1
  105.     Moveq    #RECOVERY_ALERT,d0    Not fatal to the rest of the system.
  106.     Move.l    Temp001(a5),a6        -._ Send display alert
  107.     Jsr    _LVODisplayAlert(a6)    -'  using Intuition.library
  108.  
  109.     Move.l    Temp001(a5),a1        -.
  110.     N_CallExec    CloseLibrary     |- Close intuition.library
  111.     Bra    Finish            -'  and Finish program.
  112.  
  113. OpnLib_Error_Msg_Header
  114. OpnLib_Error_Msg_Height    Equ 29
  115.     Dc.w    15        X-coord (word)
  116.     Dc.b    11        Y-coord (byte)
  117.     PROGNAM
  118.     Dc.b    ":"
  119.     SPACEEVEN    OpnLib_Error_Msg_Header
  120.     Dc.b    0,1
  121.  
  122.     Dc.w    15
  123.     Dc.b    20
  124.     Dc.b    " Could not open intuition.library v37 (Kickstart 2.04) or above!"
  125.     SPACEEVEN    OpnLib_Error_Msg_Header
  126.     Dc.b    0,0
  127.     Even
  128.